﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace ControlCenterController
{
    /// <summary>
    /// Interaction logic for InputPathWindow.xaml
    /// </summary>
    public partial class InputPathWindow : Window
    {
        public InputPathWindow(string message)
        {
            InitializeComponent();
            this.TextBlockMessage.Text = message;
        }

        private string path;
        public string Path { get { return path; } }

        private void ButtonOK_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (System.IO.Path.IsPathRooted(this.TextBoxPath.Text))
                    this.path = this.TextBoxPath.Text.EndsWith("\\") ? this.TextBoxPath.Text : this.TextBoxPath.Text + "\\";
                else
                    throw new Exception();
                this.DialogResult = true;
            }
            catch
            {
                MessageBox.Show("Sorry, but the program path you inputed is not valid.");
            }
        }

        private void ButtonCancel_Click(object sender, RoutedEventArgs e)
        {
            this.DialogResult = false;
        }
    }
}
